/**
 * 面试题02.01.移除重复节点
 */

class ListNode {
    int val;
    ListNode next;

    ListNode(int x) {
        val = x;
    }
}
class Solution {
    public ListNode removeDuplicateNodes(ListNode head) {
        ListNode slow = head;
        while (slow != null) {
            ListNode fast = slow;
            while (fast.next != null) {
                if (fast.next.val == slow.val) {
                    fast.next = fast.next.next;
                }else{
                    fast = fast.next;
                }
            }
            slow = slow.next;
        }
        return head;
    }
}